package com.gbei.center.oauth.mapper;

import com.gbei.center.model.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.common.Mapper;

/**
 * @Description: TODO
 */
@Component
public interface PlatformUserMapper extends Mapper<User> {
	/**
	 * @Description: 通过用户名和密码查询用户
	 * @param name
	 * @param password
	 * @return User  
	 * @throws
	 */
	@Select("select * from t_user where `status`=1 AND password = #{password} AND (account = #{name} OR idcard = #{name} OR mobile = #{name})")
	User selectUserByNameAndPassword(@Param("name") String name, @Param("password") String password);

	/**
	 * 根据用户ID查找记录
	 * @param userId
	 * @return
	 */
	@Select("select * from t_user where `status`=1 AND user_id = #{userId}")
	User selectByUserId(@Param("userId") String userId);
	
}
